#!/bin/bash
# Managed by puppet
# This file manages the atop binary files. It will keep binary files for last
# <%= @rotate %> days instead of 30 days provided by atop.
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# remove files older than <%= @rotate %> days
find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete

# link current to todays file
ln -f -s <%= @logpath %>/atop_$(date +%Y%m%d) <%= @logpath %>/atop_current
